1 <table height="28" cellSpacing="0" cellPadding="0" width="100%" border="0">
2       <tr align=center>
3         <td
class="title" width="100%" height="17">
4         Tin m&#
7899;i: </td>
5       </tr>
6     </table>
7 <?
8     
switch ($_GET['action'])
9     {
10         
case 'del' :
11             $id = $_GET[
'id'];
12             $sql =
"delete from news_hot where ns_id='".$id."'";
13             @$result = mysql_query($sql,$con);
14             
if ($result) echo "<p align=center class='err'>&#272;ã xóa thành công</p>";
15             
else echo "<p align=center class='err'>Không th&#7875; xóa d&#7919; li&#7879;u</p>";
16             
break;
17     }
18 ?>
19
20 <?
21     
if (isset($_POST['ButDel'])) {
22         $cnt=
0;
23         
foreach ($_POST['chk'] as $id)
24         {
25             @$result = mysql_query(
"delete from news_hot where ns_id='".$id."'",$con);
26             
if ($result) $cnt++;
27         }
28         echo
"<p align=center class='err'>&#272;ã xóa ".$cnt." ph&#7847;n t&#7917;</p>";
29     }
30 ?>
31 <?
32     $page = $_GET[
"page"];
33     $p=
0;
34     
if ($page!='') $p=$page;
35 ?>
36 <form method=
"POST" action="<? echo $_SERVER[PHP_SELF]; ?>" name="frmList">
37 <input type=hidden name=
"page" value="<? echo $page; ?>">
38 <?
39 function taotrang($sql,$link,$nitem,$itemcurrent)
40 {
global $con;
41     $ret=
"";
42     $result = mysql_query($sql, $con) or die(
'Error' . mysql_error());
43     $
value = mysql_fetch_array($result);
44     $plus = (($
value['cnt'] % $nitem)>0);
45     
for ($i=0;$i<($value[0] / $nitem) + plus;$i++)
46     {
47         
if ($i<>$itemcurrent) $ret .= "<a href=\"".$link.$i."\" class=\"lslink\">".($i+1)."</a> ";
48         
else $ret .= ($i+1)." ";
49     }
50     
return $ret;
51 }
52     $pageindex=taotrang(
"select count(*) from news_hot","./?act=news_hot&cat=".$_REQUEST['cat']."&page=",$MAXPAGE,$page);
53 ?>
54
55 <table cellspacing=
"0" cellpadding="0" width="100%">
56 <tr>
57 <td
class="smallfont">Trang : <? echo $pageindex; ?></td>
58 </tr>
59 </table>
60
61 <table border=
"1" cellpadding="2" style="border-collapse: collapse" bordercolor="#C9C9C9" width="100%" id="AutoNumber1">
62   <tr>
63     <td align=center nowrap
class="title"><input type="checkbox" name="chkall" onclick="chkallClick(this);"></td>
64     <td nowrap
class="title">&nbsp;</td>
65     <td nowrap
class="title">&nbsp;</td>
66     <td align=
"center" nowrap class="title"><b>Mã</b></td>
67     <td align=
"center" nowrap class="title"><b>Tiêu &#273;&#7873;</b></td>
68     <td align=
"center" nowrap class="title"><b>Th&#7913; t&#7921; s&#7855;p x&#7871;p</b></td>
69     <td align=
"center" nowrap class="title"><b>Không hi&#7875;n th&#7883;</b></td>
70     <td align=
"center" nowrap class="title"><b>Ngày</b></td>
71   </tr>
72   
73   <?
74                 $sql=
"select *,DATE_FORMAT(ns_dateadded,'%d/%m/%Y %h:%m') as dateformat from news_hot order by ns_id limit ".($p*$MAXPAGE).",".$MAXPAGE;
75                 $result=mysql_query($sql,$con);
76                 $i=
0;
77                 
while(($row=mysql_fetch_array($result)))
78                 {
79                     $i++;
80                     
if ($i%2) $color="#d5d5d5"; else $color="#e5e5e5";
81                     $proinfo=GetNewsInfo($row[
'news_id']);
82   ?>
83   
84   <tr>
85     <td width=
"20" align="center" bgcolor="<? echo $color; ?>" class="smallfont">
86     <input type=
"checkbox" name="chk[]" value="<? echo $row['ns_id']; ?>"></td>
87     <td width=
"20" bgcolor="<? echo $color; ?>" class="smallfont">
88     <a href=
"./?act=news_hot_m&id=<? echo $row['ns_id']; ?>&page=<? echo $page?>">
89     S&#
7917;a</a></td>
90     </td>
91     <td width=
"20" bgcolor="<? echo $color; ?>" class="smallfont">
92     <a onclick=
"return confirm('B&#7841;n có ch&#7855;c ch&#7855;n mu&#7889;n xoá ?');" href="./?act=news_hot&action=del&page=<? echo $_REQUEST['page']; ?>&id=<? echo $row['ns_id']; ?>">
93     Xóa</a></td>
94     <td width=
"20" bgcolor="<? echo $color; ?>" align="left" width="55" align="left" class="smallfont"><? echo $row['ns_id']; ?>&nbsp;</td>
95     <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $proinfo['news_subject']; ?>&nbsp;</td>
96     <td width=
"80" bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['ns_sortorder']; ?>&nbsp;</td>
97     <td width=
"80" bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['ns_status']; ?>&nbsp;</td>
98     <td width=
"100" bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['dateformat']; ?>&nbsp;</td>
99   </tr>
100   <?
101                 }
102   ?>
103 </table>
104 <input type=
"submit" value="Xóa Ch&#7885;n" name="ButDel" onclick="return confirm('B&#7841;n có ch&#7855;c ch&#7855;n mu&#7889;n xoá ?');" class="button" style="padding: 0">
105 <input type=
"hidden" name="act" value="news_hot">
106 </form>
107 <script language=
"JavaScript">
108 function chkallClick(o) {
109     
var form = document.frmList;
110     
for (var i = 0; i < form.elements.length; i++) {
111         
if (form.elements[i].type == "checkbox" && form.elements[i].name!="chkall") {
112             form.elements[i].
checked = document.frmList.chkall.checked;
113         }
114     }
115 }
116 </script>



Full source code website bán hàng thương mại điện tử gần giống shopee 468.871 lượt xem

Gõ tìm kiếm nhanh...